package com.example.studyllm.component.model;

import dev.langchain4j.data.message.AiMessage;
import dev.langchain4j.data.message.ChatMessage;
import dev.langchain4j.model.input.Prompt;
import dev.langchain4j.model.input.structured.StructuredPromptProcessor;
import dev.langchain4j.service.UserMessage;

import java.util.Arrays;

public class MyStatefulBeanFunctions {
    public static MyStatefulBean searchWeb(MyStatefulBean statefulBean) {
        // This is a simple example, you can use LangChain4j to search the web using any WebSearchEngine.
        statefulBean.webSearchResponse = "Web search response";
        statefulBean.setGeneration("hello world");
        System.out.println("searchWeb");
        return statefulBean;
    };
    public static MyStatefulBean extractRelevantDocuments(MyStatefulBean statefulBean, String... uris) {
        // This is a simple example, you can use LangChain4j to extract relevant content of the URIs using any RAG pattern.
        statefulBean.relevantDocuments = Arrays.asList("Relevant Content 1", "Relevant Content 2");
        System.out.println("extractRelevantDocuments");
        return statefulBean;
    };

    public static ChatMessage generateUserMessageUsingPrompt(MyStatefulBean statefulBean) {
        return new AiMessage("你好");
    }

}